// 文件：routes.js
import { resource, simpleRoute } from "./route-base";
import { group } from "./route-groups";
// 修正中间件导入名称
import { authMiddleware  } from "../middlewares/auth";
import { SysMenusController } from "../admin/collections/sysbase/sys_menus_controllers";
import { SysUsersController } from "../admin/collections/sysbase/sys_users_controllers";
import { SysPermissionsController } from "../admin/collections/sysbase/sys_permissions_controllers";
import { SysRolesController } from "../admin/collections/sysbase/sys_roles_controllers";

// 系统管理模块路由组（带auth中间件）
group({ prefix: "/admin-api/system", middlewares: [authMiddleware] }, ({ resource }) => {
  resource("/admin_menus", SysMenusController);
  resource("/admin_users", SysUsersController);
  resource("/admin_roles", SysRolesController);
  resource("/admin_permissions", SysPermissionsController);
});

// 普通路由（无中间件）
simpleRoute("GET", "/api/captcha", SysUsersController.captcha);